package com.example.demo.controller;

import java.security.Principal;
import java.util.LinkedHashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiangwz
 * @create 2019/4/2.
 */
@RestController
public class TestController {

    @GetMapping("/home")
    public String home(){
        return "home";
    }

    @RequestMapping({ "/user", "/me" ,"/api/v5/user" })
    public Map<String, String> user(Principal principal) {
        Map<String, String> map = new LinkedHashMap<>();
        map.put("name", principal.getName());
        System.err.println(principal);
        return map;
    }

}
